//
//  DetailDiseaseDTO.m
//  FastDoctor
//
//  Created by 李通 on 16/7/8.
//  Copyright © 2016年 sc. All rights reserved.
//

#import "DetailDiseaseDTO.h"

@implementation DetailDiseaseDTO

+ (instancetype)modelWithDict:(NSDictionary *)dict {
    
    DetailDiseaseDTO *diseaseModel = [[DetailDiseaseDTO alloc]init];
    
    [diseaseModel setValuesForKeysWithDictionary:dict];
    
    return diseaseModel;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
    
}

+ (void)getDiseaseListSuccess:(void (^)(NSArray<DetailDiseaseDTO *> *))successBlock error:(void (^)())errorBlock {
    
    [SVProgressHUD show];
    
    NSDictionary *paramDic = @{
                               @"page_size":@15,
                               @"page":@1,
                               @"ci1_id":@1,
                               @"keyword":@""
                               };
    
    [[NetWorkTool sharedWorkTool]POST:kSearchCI3Url parameters:paramDic progress:nil success:^(NSURLSessionDataTask * _Nonnull task, NSDictionary *  _Nullable responseObject) {
        
        NSArray *array = responseObject[@"data"];
        
        NSMutableArray *mArray = [NSMutableArray array];
        
        [array enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            DetailDiseaseDTO *diseaseModel = [DetailDiseaseDTO modelWithDict:obj];
            
            [mArray addObject:diseaseModel];
        }];
        if (successBlock) {
            
            successBlock(mArray.copy);
        }
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
        if (errorBlock) {
            errorBlock();
        }
    }];
}

@end
